﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Manage_InfoManage : System.Web.UI.Page ,IAccess
{
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentAccount.CheckSessionTimeOut(this);
        if (!IsPostBack)
        {
            BindData();
            GetValue();
        }
    }


    private void BindData()
    {
        var list = BLL_Factory.IBLL_Manage.GetConfigurationKeys();
        foreach (var item in list)
        {
            ddlkeys.Items.Add(item);
        }
    }

    private void GetValue()
    {

        var value = BLL_Factory.IBLL_Manage.GetConfigurationByKey(ddlkeys.SelectedValue);
        txtInfo.Text = value.Value;
        lblDes.Text = value.KeyDescription;
    }
    protected void ddlkeys_SelectedIndexChanged(object sender, EventArgs e)
    {
        GetValue();

    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (BLL_Factory.IBLL_Manage.SetConfiguration(ddlkeys.SelectedValue, txtInfo.Text) == 1)
        {
            HZ.Web.WebUtil.Alert("保存成功", this);
        }
        else
        {
            HZ.Web.WebUtil.Alert("保存失败");
        }
    }
    #region IAccess Members

    IList<EnumAccess> IAccess.AccessList
    {
        get
        {
            var list = new List<EnumAccess>();
            list.Add(EnumAccess.Manage);
            return list;
        }

    }

    #endregion
}
